﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using MinhTuan;
namespace Products
{
    public class Supply
    {
        private Int32 _Supply_Id;
        private String _Supply_Name;
        private String _Supply_Adress;
        private String _Supply_Tel;
        private String _Sypply_Fax;
        private String _Sypply_Mail;
        private String _Notice;
        public Supply()
        {

        }
        public Supply(
            Int32 Supply_Id,
            String Supply_Name,
            String Supply_Adress,
            String Supply_Tel,
            String Sypply_Fax,
            String Sypply_Mail,
            String Notice
            )
        {
            _Supply_Id = Supply_Id;
            _Supply_Name = Supply_Name;
            _Supply_Adress = Supply_Adress;
            _Supply_Tel = Supply_Tel;
            _Sypply_Fax = Sypply_Fax;
            _Sypply_Mail = Sypply_Mail;
            _Notice = Notice;
        }

        public Int32 Supply_Id
        {
            get { return _Supply_Id; }
            set { _Supply_Id = value; }
        }

        public String Supply_Name
        {
            get { return _Supply_Name; }
            set { _Supply_Name = value; }
        }

        public String Supply_Adress
        {
            get { return _Supply_Adress; }
            set { _Supply_Adress = value; }
        }

        public String Supply_Tel
        {
            get { return _Supply_Tel; }
            set { _Supply_Tel = value; }
        }

        public String Sypply_Fax
        {
            get { return _Sypply_Fax; }
            set { _Sypply_Fax = value; }
        }

        public String Sypply_Mail
        {
            get { return _Sypply_Mail; }
            set { _Sypply_Mail = value; }
        }

        public String Notice
        {
            get { return _Notice; }
            set { _Notice = value; }
        }
        public static DataTable GetAll()
        {
            DataTable tbl = new DataTable();
            try
            {
                Access.InitAccess();
                Access.mySqlCommand.CommandText = "Sp_Supply_GetAll";
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(Access.mySqlCommand);
                da.Fill(ds);
                Access.ClosedAccess();
                return ds.Tables[0];
            }
            catch
            {
                Access.ClosedAccess();
                return tbl;
            }
        }
    }
}
